Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
@babel/plugin-transform-spread
Advanced tools
The @babel/plugin-transform-spread npm package is a plugin for Babel, a JavaScript compiler, that transforms spread properties in object literals and spread elements in array literals into a form that can be understood by environments that do not support the spread syntax. This transformation ensures compatibility with older browsers or JavaScript environments.
Object Spread
Transforms spread properties in object literals to use Object.assign, enabling the combination of multiple objects into one.
{"const obj1 = { a: 1, b: 2 };\nconst obj2 = { ...obj1, c: 3 };\n// Transformed to:\n// const obj2 = Object.assign({}, obj1, { c: 3 });"}
Array Spread
Transforms spread elements in array literals to use Array.concat, allowing the creation of new arrays by combining or adding elements.
{"const arr1 = [1, 2];\nconst arr2 = [...arr1, 3, 4];\n// Transformed to:\n// const arr2 = arr1.concat([3, 4]);"}
This package provides functionality similar to @babel/plugin-transform-spread but focuses on both spreading of elements and the rest properties for object destructuring assignment and spread properties for object literals. It's a more comprehensive solution for handling spread and rest properties in modern JavaScript.
While not a direct alternative, core-js includes polyfills for many ECMAScript features, including the spread syntax. It allows developers to use spread syntax in environments that do not natively support it by providing the necessary polyfills.
Compile ES2015 spread to ES5
See our website @babel/plugin-transform-spread for more information.
Using npm:
npm install --save-dev @babel/plugin-transform-spread
or using yarn:
yarn add @babel/plugin-transform-spread --dev
v7.24.7 (2024-06-05)
babel-node
babel-traverse
constantViolations
with destructuring (@liuxingbaoyu)babel-helper-transform-fixture-test-runner
, babel-plugin-proposal-explicit-resource-management
using
in switch
correctly (@liuxingbaoyu)babel-helpers
, babel-runtime-corejs2
, babel-runtime-corejs3
, babel-runtime
FAQs
Compile ES2015 spread to ES5
The npm package @babel/plugin-transform-spread receives a total of 19,812,255 weekly downloads. As such, @babel/plugin-transform-spread popularity was classified as popular.
We found that @babel/plugin-transform-spread demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.